<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>信息管理</title>
    <%
        /********** 保存网站的基本路径 ***********/
        String path = request.getContextPath();
        String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
                + path + "/";
        //将该路径地址缓存到 session中 ,例如：http://localhost:8090/tjnu_ssh_1128/
        session.setAttribute("mybasePath", basePath);
    %>
    <!-- CSS -->
    <jsp:include page="../include/headtag.jsp" />
    <!-- <link rel="stylesheet"
        href="http://fonts.googleapis.com/css?family=Roboto:400,100,300,500"> -->
    <link rel="stylesheet"
          href="${mybasePath}assets/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="${mybasePath}assets/css/form-elements.css">
    <link rel="stylesheet" href="${mybasePath}assets/css/style.css">

</head>
<body>
<jsp:include page="../include/head1.jsp" />
<jsp:include page="../include/menu1.jsp" />
<div id="page-wrapper" style="margin-top: 50px;">
    <div id="page-inner">
        <div class="row">
            <div class="col-md-12">
                <h3 class="text-left">订单管理</h3>
            </div>
        </div>
        <hr />
        <ul class="nav nav-tabs">
            <li class="active"><a href="#order" data-toggle="tab">订单信息</a></li>
        </ul>
        <br>
        <div id="myTabContent" class="tab-content">
            <div class="tab-pane fade active in text-left" id="order">
                <div class="col-md-12">
                    <!-- <div class="col-md-3"> -->
                    <p class="text-left">
                        <font color="#eb6864">预约信息</font>
                        <button onclick="run();">查询</button>
                    </p>
                    <!-- </div> -->
                </div>
                <form  id="setchInfo"
                      action="<c:url value='/uni/alldingdan/1' />" method="post">
                </form>

                <table class="table table-striped table-hover ">
                    <thead>
                    <tr>
                        <th>订单</th>
                        <th>就诊日期</th>
                        <th>就诊时间段</th>
                        <th>医院</th>
                        <th>科室</th>
                        <th>医生</th>
                        <th>订单状态</th>
                        <th>订单创建时间</th>
                        <th>审核</th>
                    </tr>
                    </thead>
                    <tbody>
                    <c:forEach var="orderRecords" items="${orderRecords}"
                               varStatus="status">
                        <tr>
                            <td>${ status.index + 1}</td>
                                <%-- <td><a href="<c:url value='/officeInfoShow/${off.id}' />">${orderRecords.transactDate }</a></td> --%>
                            <td>${orderRecords.transactDate }</td>
                            <td>${orderRecords.transactTime }</td>
                            <td>${orderRecords.hospitalName }</td>
                            <td>${orderRecords.officesName }</td>
                            <td>${orderRecords.doctorName }</td>
                            <td><c:if test="${orderRecords.isFinish ==0 }">
                                <c:if test="${orderRecords.isCancel ==0 }">
                                    <c:if test="${orderRecords.isSuccess ==0 }">
                                        <c:if test="${orderRecords.orderVer ==1 }">订单已提交(待审核)</c:if>
                                    </c:if>
                                </c:if>
                            </c:if> <c:if test="${orderRecords.isFinish ==0 }">
                                <c:if test="${orderRecords.isCancel ==0 }">
                                    <c:if test="${orderRecords.isSend ==0 }">
                                        <c:if test="${orderRecords.isSuccess ==1 }">
                                            <font color="#eb6468">预约成功(待通知)</font>
                                        </c:if>
                                    </c:if>
                                </c:if>
                            </c:if> <c:if test="${orderRecords.isFinish ==0 }">
                                <c:if test="${orderRecords.isCancel ==0 }">
                                    <c:if test="${orderRecords.isSend ==1 }">
                                        <c:if test="${orderRecords.isSuccess ==1 }">
                                            <font color="#eb6468">预约成功(已通知)</font>
                                        </c:if>
                                    </c:if>
                                </c:if>
                            </c:if> <c:if test="${orderRecords.isCancel ==1 }">
                                <font color="#000">已取消</font>
                            </c:if> <c:if test="${orderRecords.isFinish ==1 }">
                                <font color="#eb6468">订单已完成</font>
                            </c:if></td>
                            <td>${orderRecords.createTime }</td>
                            <td>
                                <button  onclick="fun(${orderRecords.id});">通过</button>

                            </td>

                        </tr>
                    </c:forEach>
                    </tbody>
                </table>

                <c:if test="${pages.totalPage > 0}">
                    <ul class="pagination pagination-lg">
                        <li <c:if test="${pages.currentPage < 1}">class="disabled"</c:if>><a
                                href="#">&laquo;</a></li>
                        <c:forEach begin="${pages.pageNumStart }" end="${pages.pageNumEnd }"
                                   varStatus="status">
                            <li
                                    <c:if test="${status.index == pages.currentPage }">class="active"</c:if>>
                                <a href="javascript:void(0);" onclick="tijiao('${status.index }')">
                                        ${status.index } </a>
                            </li>
                        </c:forEach>
                        <li
                                <c:if test="${pages.currentPage> pages.totalPage}">class="disabled"</c:if>><a
                                href="javascript:void(0);" onclick="tijiao('${pages.nextPage }')">&raquo;</a></li>
                        <li><input id="tijiaoInput" name="tijiaoInput" type="text"
                                   class="form-control col-md-1" style="width: 60px; height: 54.89px;"></li>
                        <li><a onclick="tijiaoInput()">Go</a></li>
                        <li class="disabled"><a>共${pages.totalPage}页${pages.totalRecord}条记录</a>
                    </ul>
                </c:if>
            </div>
            <script>
                function fun(aa)
                {
                    window.location.href="${pageContext.request.contextPath}/uni/update?id="+aa;
                }

            </script>
            <script>
                function run()
                {
                    <%--$.ajax({--%>

                    <%--    async : true,--%>
                    <%--    url : "${pageContext.request.contextPath}/uni/findord",--%>

                    <%--    data:--%>
                    <%--        {--%>
                    <%--        },--%>
                    <%--    error : function(errorMsg) {--%>
                    <%--        //请求失败时执行该函数--%>
                    <%--        alert("请求数据失败!");--%>
                    <%--        // myChart.hideLoading();--%>
                    <%--    }--%>
                    <%--});--%>
                    window.location.href="${pageContext.request.contextPath}/uni/findord";
                }
            </script>
                    </div>

                </div>
            </div>

        </div>

    </div>

    <!-- /. PAGE INNER  -->
</div>
<!-- /. PAGE WRAPPER  -->

</body>
<!-- Javascript -->
<script src="${mybasePath}assets/bootstrap/js/jquery.min.js"></script>
<script src="${mybasePath}assets/js/jquery.backstretch.min.js"></script>
<script type="text/javascript">
    function tijiao(url) {
        $("#setchInfo")
            .attr("action", "<c:url value='/uni/alldingdan/"+url+"' />");
        $("#setchInfo").submit();
        return false;
    }
</script>
<script type="text/javascript">
    function tijiaoInput() {
        var url = $("#tijiaoInput").val();
        if (url == "") {
            alert("请输入翻页数目");
            $("#tijiaoInput").attr("value", "");
            return false;
        } else {
            var match = /^[1-9][0-9]*[0-9]*$/;
            if (!match.test(url)) {
                $("#tijiaoInput").val("");
                alert("请正确填写翻页数目");

                return false;
            }
        }
        $("#setchInfo")
            .attr("action", "<c:url value='/uni/alldingdan/"+url+"' />");
        $("#setchInfo").submit();
        return false;
    }
</script>
<script type="text/javascript">
    $(function() {
        $("#updateSexButton")
            .click(
                function() {
                    $
                        .post(
                            "/ssm_pro/updateSex",
                            {
                                'userSex' : $("#userSex").val()
                            },
                            function(result) {
                                if (result.userSexInfo != "") {

                                    if (result.userSexInfo == "男") {
                                        alert("修改成功");
                                        var userSexInfo = '<option value="男">男</option>';
                                        userSexInfo += '<option value="女">女</option>'
                                        $(
                                            "select[name='userSex']")
                                            .empty()
                                            .append(
                                                userSexInfo);
                                    } else {
                                        alert("修改成功");
                                        var userSexInfo = '<option value="女">女</option>';
                                        userSexInfo += '<option value="男">男</option>';
                                        $(
                                            "select[name='userSex']")
                                            .empty()
                                            .append(
                                                userSexInfo);
                                    }
                                    /* var noticeTypes = '<option value="-1">请选择</option>';
                                    $.each(result.noticeTypes, function(i,item){

                                        noticeTypes += '<option value="'+item.id+'">'+item.dictionaryValue+'</option>';
                                    });

                                    $("select[name='noticeTypeId']").empty().append(noticeTypes); */
                                }
                            });
                });
    });
</script>
<script type="text/javascript">
    function cancel() {
        $("#cancel").submit();
        return false;
    }
</script>
</html>